//
//  ViewController.m
//  IOS2
//
//  Created by blue on 15-11-19.
//  Copyright (c) 2015年 zx. All rights reserved.
//

#import "ViewController.h"
#import "inputTableViewController.h"

@interface ViewController () <UITableViewDataSource,UITableViewDelegate>

@property (strong,nonatomic)UITableView *tableview;

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    self.title =@"通讯录";
    self.tableview = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.tableview.dataSource = self;
    self.tableview.delegate = self;
    [self.view addSubview:self.tableview];
    
    
    
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
    
}

- (UITableViewCell * )tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
    cell.textLabel.text = @"姓名";
    cell.detailTextLabel.text = @"电话号码";
    //插入图片
    cell.imageView.image = [UIImage imageNamed:@"8.jpg"];
    return cell;
    
    
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    inputTableViewController * con = [[inputTableViewController alloc]initWithStyle:UITableViewStyleGrouped];
    UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];
    con.tel = cell.detailTextLabel.text;
    [self.navigationController pushViewController:con animated:YES];
    
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
